<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>组合查询</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link rel="stylesheet" type="text/css" href="../../css/style.css">
	<script type="text/javascript" src="../../js/jquery-1.8.2.js"></script>
	<script type="text/javascript" src="../../js/dialog/jquery.artDialog.source.js?skin=default"></script>
	<script type="text/javascript" src="../../js/dialog/plugins/iframeTools.source.js"></script>
	<script type="text/javascript" src="../../js/jquery.ztree.all-3.5.min.js"></script>
	<script type="text/javascript" src="../../js/jquery.form.js"></script>
	<script type="text/javascript" src="../../js/jquery.page.js"></script>
	<script type="text/javascript" src="../../js/base.js"></script>
</head>
<body class="app">
	<h3>组合查询</h3>
	<form class="search" name="search">
		<div class="tbdiv">
		<table>
			<tr>
				<th><input type="checkbox"/></th>
				<td><select name="adminCode"></select></td>
				<th><input type="checkbox"/></th>
				<td width="100"><select name="propertyCode"></select></td>
				<th width="60"><input type="checkbox"/></th>
				<td width="220"><select name="serviceCode"></select></td>
				<th><input type="checkbox"/></th>
				<td colspan="2">
					<input type="hidden" name="areaName" value=""/>
					<input type="text" class="inputText" name="areaNameN" value="所属区域" style="width:150px;*width:151px;cursor:pointer;" readonly="readonly" />
				</td>
			</tr>
			<tr>
				<th><input type="checkbox"/></th>
				<td colspan="3">
					<select><option>-部件类型-</option></select>
					<select><option>-运行次数-</option></select>
				</td>
				<th><input type="checkbox"/></th>
				<td colspan="4">
					<select name="faultType" style="width:100px;"></select>
					<select><option>-故障次数-</option></select>
				</td>
			</tr>
			<tr>
				<th><input type="checkbox"/></th>
				<td><select><option>-故障率-</option></select></td>
				<th><input type="checkbox"/></th>
				<td><select><option>-年检次数-</option></select></td>
				<th><input type="checkbox"/></th>
				<td colspan="5"><select><option>-维保次数-</option></select></td>
			</tr>
			<tr>
				<th><input type="checkbox"/></th>
				<td><select><option>-电梯品牌-</option></select></td>
				<th><input type="checkbox"/></th>
				<td><select><option>-安装时间-</option></select></td>
				<th>起始时间：</th>
				<td colspan="4">
					<input type="text" class="inputText" name="" style="width:100px"/>&nbsp;&nbsp;
					截止时间：<input type="text" class="inputText" name="" style="width:100px"/>
					<input type="submit" class="inputButton" value="查询"/>
				</td>
			</tr>
		</table>
		</div>
	</form>
	<div id="list"></div>
	<div class="optionlink">
		<span id="btnPrint">【打印】</span>
		<span id="btnExcel">【导出Excel】</span>
	</div>
	<div class="areaTree" style="width:156px;"><div id="areaTree" class="ztree"></div></div>
	<div id="view" style="width:650px;display:none;">
		<form name="saveFrom" action="jbxxwh_save.action" method="post">
		<input type="hidden" name="eleBasicId" />
		<dl class="view">
			<dt>电梯号码：</dt>
			<dd><input type="text" class="inputText" style="width:95%" name="eleCode" /></dd>
			<div class="cl"></div>
		</dl>
		</form>
	</div>
	<script type="text/javascript">
	$(function(){
		$(document.search).ajaxForm({
			beforeSubmit:function(formData){
				var param = $(formData).formParam();
				$('#list').page('param',param);
				$('#list').page('show');
				return false;
			}
		});
		$(document.saveFrom).ajaxForm({
			success:function(response){
				var param = $(document.search).formParam();
				$('#list').page('param',param);
				$('#list').page('show');
			}
		});
		//分页列表
		$('#list').page({
			url:'zhcx_search.action',
			config:'pageinfo,record,first,last,next,prev,jump',
			items:[{
				title:'电梯名称',
				name:'eleCode'
			},{
				title:'注册代码',
				name:'eleName'
			},{
				title:'行政监管单位',
				name:'eleBasicStyleText'
			},{
				title:'维保单位',
				name:'eleFloor'
			},{
				title:'电梯品牌',
				name:'eleFloor'
			},{
				title:'详情',
				render:function(row){
					$a = $('<a href="javascript:void(0)")">【详细】</a>');
					$a.click(function(){
						view(row);
					});
					return $a;
				}
			}]
		});
		$('#btnAdd').click(function(){
			view(null);
		});
		$('#btnDel').click(function(){
			$.dialog.confirm('您确认删除所选电梯吗？',function(){
				var ids = $('#list').data('checked').join(',');
				$.post('jbxxwh_del.action',{ids:ids},function(response){
					$('#list').page('show',1);
				});
			});
		});
	});

	$(function(){
		//绑定行政监管单位
		$('select[name=adminCode]').selectload('../../common/adminunit_select.action','adminCode','adminName',null,null,null,'行政监管单位');
		$('select[name=propertyCode]').selectload('../../common/propertyunit_select.action','propertyCode','propertyName',null,null,null,'物业公司');
		$('select[name=serviceCode]').selectload('../../common/serviceunit_select.action','serviceCode','serviceName',null,null,null,'维保单位');
		$('select[name=faultType]').selectload('../../common/code.action','code','codedesc',{codepid:'26'},null,null,'故障类型');
		//渲染区域树
		$.fn.zTree.init($('#areaTree'),{
			data: {
				key:{
					name:'areaname'
				},
				simpleData: {
					enable: true,
					idKey:'areacode',
					pIdKey:'parentcode',
					rootPId:0
				}
			},
			async: {
				enable: true,
				url:"../../common/area_tree.action",
				autoParam:["areacode"]
			},
			callback:{
				onClick:function(e,id,node){
					if(node.isParent == false){
						$('input[name=areaName]').val(node.areacode);
						var $areaTree = $('.areaTree');
						var areaArr = new Array();
						areaArr.unshift(node.areaname);
						while(node.parentcode > 0){
							node = node.getParentNode();
							areaArr.unshift(node.areaname);
						}
						$('input[name=areaNameN]').val(areaArr.join(' > '));
						$areaTree.hide();
					}
				}
			}
		});
		$('input[name=areaNameN]').click(function(){
			$this = $(this);
			$hidden = $('input[name=areaName]');
			$areaTree = $('.areaTree');
			$this.val('');
			$hidden.val('');
			var os = $this.offset();
			$areaTree.css({left:os.left,top:os.top+($this.outerHeight(true)-1)});
			$areaTree.show();
		});
		$(document).mouseup(function(e){
			var $target = $(e.target);
			if(!$target.is('.areaTree')){
				if($target.parents('.areaTree').length == 0){
					$('.areaTree').hide();
				}
			}
		});
		//区域树结束
	})
	
	var view = function(row){
		$(document.saveFrom).resetForm();
		$(document.saveFrom.eleBasicId).val('');
		$.dialog({
			id:'viewdialog',
			title:'基本信息维护',
			lock:true,
			padding:'5px 8px 5px 5px',
			content:document.getElementById('view')
		});
		$(document.saveFrom).json2form(row);
	}
	</script>
</body>
</html>
